package fr.louloutes.lolshooter.engine.objects.protagonists;

import fr.louloutes.lolshooter.engine.objects.GameObject;
import fr.louloutes.lolshooter.engine.objects.weapons.Weapon;
import fr.louloutes.lolshooter.engine.sprites.LolSprite;

/**
 * Class Protagonist: abstract class for any monster or player in game
 * 
 * @author Louloute
 * 
 */
public abstract class Protagonist extends GameObject
{
	LifeBar lifeBar;
	Weapon weapon;

	/**
	 * Constructor with initializations
	 * 
	 * @param life
	 * @param sprite
	 * @param weapon
	 */
	public Protagonist( int life, LolSprite sprite, Weapon weapon )
	{
		super( sprite );
		lifeBar = new LifeBar( life );
		this.weapon = weapon;
	}

	/**
	 * Is current Protagonist dead ?
	 * 
	 * @return
	 */
	public boolean isDead()
	{
		return lifeBar.isEmpty();
	}

	/**
	 * Increase Protagonist's life
	 * 
	 * @param addlife
	 */
	public void addLife( int addlife )
	{
		lifeBar.addLife( addlife );
	}

	/**
	 * Decrease Protagonist's life
	 * 
	 * @param decreaselife
	 */
	public void decreaseLife( int decreaselife )
	{
		lifeBar.decreaseLife( decreaselife );
	}

	/**
	 * Return the current weapon.
	 * 
	 * @return
	 */
	public Weapon getWeapon()
	{
		return weapon;
	}

}
